home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / CIncludes / Printing.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  8.7 KB  |  331 lines  |  [TEXT/MPS ]

  1.  
  2. /************************************************************
  3.  
  4. Created: Thursday, September 12, 1991 at 3:00 PM
  5.  Printing.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1985-1991
  10.   All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __PRINTING__
  16. #define __PRINTING__
  17.  
  18. #ifndef __QUICKDRAW__
  19. #include <Quickdraw.h>
  20. #endif
  21.  
  22. #ifndef __DIALOGS__
  23. #include <Dialogs.h>
  24. #endif
  25.  
  26.  
  27. enum {
  28.  
  29.  iPFMaxPgs = 128,
  30.  iPrPgFract = 120,                /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  31.  iPrPgFst = 1,                    /*Page range constants*/
  32.  iPrPgMax = 9999,
  33.  iPrRelease = 3,                /*Current version number of the code.*/
  34.  iPrSavPFil = -1,
  35.  iPrAbort = 0x0080,
  36.  iPrDevCtl = 7,                    /*The PrDevCtl Proc's ctl number*/
  37.  lPrReset = 0x00010000,            /*The PrDevCtl Proc's CParam for reset*/
  38.  lPrLineFeed = 0x00030000,
  39.  lPrLFStd = 0x0003FFFF,            /*The PrDevCtl Proc's CParam for std paper advance*/
  40.  lPrLFSixth = 0x0003FFFF,
  41.  lPrPageEnd = 0x00020000,        /*The PrDevCtl Proc's CParam for end page*/
  42.  lPrDocOpen = 0x00010000,
  43.  lPrPageOpen = 0x00040000,
  44.  lPrPageClose = 0x00020000,
  45.  lPrDocClose = 0x00050000,
  46.  iFMgrCtl = 8,                    /*The FMgr's Tail-hook Proc's ctl number*/
  47.  iMemFullErr = -108,
  48.  iIOAbort = -27
  49. };
  50. enum {
  51.  pPrGlobals = 0x00000944,        /*The PrVars lo mem area:*/
  52.  bDraftLoop = 0,
  53.  bSpoolLoop = 1,
  54.  bUser1Loop = 2,
  55.  bUser2Loop = 3,
  56.  iPrBitsCtl = 4,
  57.  lScreenBits = 0,
  58.  lPaintBits = 1,
  59.  lHiScreenBits = 0x00000002,    /*The Bitmap Print Proc's Screen Bitmap param*/
  60.  lHiPaintBits = 0x00000003,        /*The Bitmap Print Proc's Paint [sq pix] param*/
  61.  iPrIOCtl = 5,
  62.  iPrEvtCtl = 6,                    /*The PrEvent Proc's ctl number*/
  63.  lPrEvtAll = 0x0002FFFD,        /*The PrEvent Proc's CParam for the entire screen*/
  64.  lPrEvtTop = 0x0001FFFD,        /*The PrEvent Proc's CParam for the top folder*/
  65.  
  66. #define sPrDrvr ".Print"
  67.  
  68.  iPrDrvrRef = -3,
  69.  getRslDataOp = 4,
  70.  setRslOp = 5,
  71.  draftBitsOp = 6,
  72.  noDraftBitsOp = 7,
  73.  getRotnOp = 8
  74. };
  75. enum {
  76.  NoSuchRsl = 1,
  77.  OpNotImpl = 2,                    /*the driver doesn't support this opcode*/
  78.  RgType1 = 1
  79. };
  80.  
  81. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  82. typedef unsigned char TFeed;
  83.  
  84. enum {scanTB,scanBT,scanLR,scanRL};
  85. typedef unsigned char TScan;
  86.  
  87.  
  88. typedef Rect *TPRect;            /* A Rect Ptr */
  89. typedef pascal void (*PrIdleProcPtr)(void);
  90. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  91.  
  92. struct TPrPort {
  93.  GrafPort gPort;                /*The Printer's graf port.*/
  94.  QDProcs gProcs;                /*..and its procs*/
  95.  long lGParam1;                    /*16 bytes for private parameter storage.*/
  96.  long lGParam2;
  97.  long lGParam3;
  98.  long lGParam4;
  99.  Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  100.  Boolean fOurBits;                /*Whether the BitMap allocation was done by us.*/
  101. };
  102.  
  103. typedef struct TPrPort TPrPort;
  104. typedef TPrPort *TPPrPort;
  105.  
  106. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  107.   This is the "PrPeek" record. */
  108. struct TPrInfo {
  109.  short iDev;                    /*Font mgr/QuickDraw device code*/
  110.  short iVRes;                    /*Resolution of device, in device coordinates*/
  111.  short iHRes;                    /*..note: V before H => compatable with Point.*/
  112.  Rect rPage;                    /*The page (printable) rectangle in device coordinates.*/
  113. };
  114.  
  115. typedef struct TPrInfo TPrInfo;
  116. typedef TPrInfo *TPPrInfo;
  117.  
  118. /* Print Info Record: The parameters needed for page composition. */
  119. struct TPrStl {
  120.  short wDev;
  121.  short iPageV;
  122.  short iPageH;
  123.  char bPort;
  124.  TFeed feed;
  125. };
  126.  
  127. typedef struct TPrStl TPrStl;
  128. typedef TPrStl *TPPrStl;
  129.  
  130. struct TPrXInfo {
  131.  short iRowBytes;
  132.  short iBandV;
  133.  short iBandH;
  134.  short iDevBytes;
  135.  short iBands;
  136.  char bPatScale;
  137.  char bUlThick;
  138.  char bUlOffset;
  139.  char bUlShadow;
  140.  TScan scan;
  141.  char bXInfoX;
  142. };
  143.  
  144. typedef struct TPrXInfo TPrXInfo;
  145. typedef TPrXInfo *TPPrXInfo;
  146.  
  147. struct TPrJob {
  148.  short iFstPage;                /*Page Range.*/
  149.  short iLstPage;
  150.  short iCopies;                    /*No. copies.*/
  151.  char bJDocLoop;                /*The Doc style: Draft, Spool, .., and ..*/
  152.  Boolean fFromUsr;                /*Printing from an User's App (not PrApp) flag*/
  153.  PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  154.  StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  155.  short iFileVol;                /*Spool File vol, set to 0 initially*/
  156.  char bFileVers;                /*Spool File version, set to 0 initially*/
  157.  char bJobX;                    /*An eXtra byte.*/
  158. };
  159.  
  160. typedef struct TPrJob TPrJob;
  161. typedef TPrJob *TPPrJob;
  162.  
  163. /* Print Job: Print "form" for a single print request. */
  164. struct TPrint {
  165.  short iPrVersion;                /*(2) Printing software version*/
  166.  TPrInfo prInfo;                /*(14) the PrInfo data associated with the current style.*/
  167.  Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  168.  TPrStl prStl;                    /*(8)  This print request's style.*/
  169.  TPrInfo prInfoPT;                /*(14)  Print Time Imaging metrics*/
  170.  TPrXInfo prXInfo;                /*(16)  Print-time (expanded) Print info record.*/
  171.  TPrJob prJob;                    /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  172.  short printX[19];                /*Spare to fill to 120 bytes!*/
  173. };
  174.  
  175. typedef struct TPrint TPrint;
  176. typedef TPrint *TPPrint, **THPrint;
  177.  
  178. /* The universal 120 byte printing record */
  179. struct TPrStatus {
  180.  short iTotPages;                /*Total pages in Print File.*/
  181.  short iCurPage;                /*Current page number*/
  182.  short iTotCopies;                /*Total copies requested*/
  183.  short iCurCopy;                /*Current copy number*/
  184.  short iTotBands;                /*Total bands per page.*/
  185.  short iCurBand;                /*Current band number*/
  186.  Boolean fPgDirty;                /*True if current page has been written to.*/
  187.  Boolean fImaging;                /*Set while in band's DrawPic call.*/
  188.  THPrint hPrint;                /*Handle to the active Printer record*/
  189.  TPPrPort pPrPort;                /*Ptr to the active PrPort*/
  190.  PicHandle hPic;                /*Handle to the active Picture*/
  191. };
  192.  
  193. typedef struct TPrStatus TPrStatus;
  194. typedef TPrStatus *TPPrStatus;
  195.  
  196. /* Print Status: Print information during printing. */
  197. struct TPfPgDir {
  198.  short iPages;
  199.  long iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  200. };
  201.  
  202. typedef struct TPfPgDir TPfPgDir;
  203. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  204.  
  205. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  206. struct TPrDlg {
  207.  DialogRecord Dlg;                /*The Dialog window*/
  208.  ModalFilterProcPtr pFltrProc;    /*The Filter Proc.*/
  209.  PItemProcPtr pItemProc;        /*The Item evaluating proc.*/
  210.  THPrint hPrintUsr;                /*The user's print record.*/
  211.  Boolean fDoIt;
  212.  Boolean fDone;
  213.  long lUser1;                    /*Four longs for user's to hang global data.*/
  214.  long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  215.  long lUser3;
  216.  long lUser4;
  217. };
  218.  
  219. typedef struct TPrDlg TPrDlg;
  220. typedef TPrDlg *TPPrDlg;
  221.  
  222.  
  223. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  224.  
  225. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  226. Print Dialog: The Dialog Stream object. */
  227.  
  228.  
  229.  
  230. struct TGnlData {
  231.  short iOpCode;
  232.  short iError;
  233.  long lReserved;                /*more fields here depending on call*/
  234. };
  235.  
  236. typedef struct TGnlData TGnlData;
  237.  
  238. struct TRslRg {
  239.  short iMin;
  240.  short iMax;
  241. };
  242.  
  243. typedef struct TRslRg TRslRg;
  244.  
  245. struct TRslRec {
  246.  short iXRsl;
  247.  short iYRsl;
  248. };
  249.  
  250. typedef struct TRslRec TRslRec;
  251.  
  252. struct TGetRslBlk {
  253.  short iOpCode;
  254.  short iError;
  255.  long lReserved;
  256.  short iRgType;
  257.  TRslRg xRslRg;
  258.  TRslRg yRslRg;
  259.  short iRslRecCnt;
  260.  TRslRec rgRslRec[27];
  261. };
  262.  
  263. typedef struct TGetRslBlk TGetRslBlk;
  264.  
  265. struct TSetRslBlk {
  266.  short iOpCode;
  267.  short iError;
  268.  long lReserved;
  269.  THPrint hPrint;
  270.  short iXRsl;
  271.  short iYRsl;
  272. };
  273.  
  274. typedef struct TSetRslBlk TSetRslBlk;
  275.  
  276. struct TDftBitsBlk {
  277.  short iOpCode;
  278.  short iError;
  279.  long lReserved;
  280.  THPrint hPrint;
  281. };
  282.  
  283. typedef struct TDftBitsBlk TDftBitsBlk;
  284.  
  285. struct TGetRotnBlk {
  286.  short iOpCode;
  287.  short iError;
  288.  long lReserved;
  289.  THPrint hPrint;
  290.  Boolean fLandscape;
  291.  char bXtra;
  292. };
  293.  
  294. typedef struct TGetRotnBlk TGetRotnBlk;
  295.  
  296.  
  297. #ifdef __cplusplus
  298. extern "C" {
  299. #endif
  300. pascal void PrPurge(void); 
  301. pascal void PrNoPurge(void); 
  302. pascal void PrOpen(void); 
  303. pascal void PrClose(void); 
  304. pascal void PrintDefault(THPrint hPrint); 
  305. pascal Boolean PrValidate(THPrint hPrint); 
  306. pascal Boolean PrStlDialog(THPrint hPrint); 
  307. pascal Boolean PrJobDialog(THPrint hPrint); 
  308. pascal TPPrDlg PrStlInit(THPrint hPrint); 
  309. pascal TPPrDlg PrJobInit(THPrint hPrint); 
  310. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst); 
  311. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit); 
  312. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf); 
  313. pascal void PrCloseDoc(TPPrPort pPrPort); 
  314. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame); 
  315. pascal void PrClosePage(TPPrPort pPrPort); 
  316. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  317.  TPrStatus *prStatus); 
  318. pascal short PrError(void); 
  319. pascal void PrSetError(short iErr); 
  320. pascal void PrGeneral(Ptr pData); 
  321. pascal void PrDrvrOpen(void); 
  322. pascal void PrDrvrClose(void); 
  323. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3); 
  324. pascal Handle PrDrvrDCE(void); 
  325. pascal short PrDrvrVers(void); 
  326. #ifdef __cplusplus
  327. }
  328. #endif
  329.  
  330. #endif
  331.